package com.sto.stoapp.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.sto.stoapp.activity.R;
import com.sto.stoapp.entity.StatisticsEntity;

/**
 * 显示业务统计 已发、未发  适配器 
 * @author Administrator
 *
 */
public class InquiryStatisticsAdapter extends BaseAdapter {

	private List<StatisticsEntity> courierList;

	private Context context;

	/**
	 * 构造函数
	 * 
	 * @param context
	 * @param courierList
	 */
	public InquiryStatisticsAdapter(Context context, List<StatisticsEntity> list) {
		this.courierList = list;
		this.context = context;
	}

	@Override
	public int getCount() {
		return courierList == null ? 0 : courierList.size();
	}

	@Override
	public Object getItem(int arg0) {
		return courierList.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		Holder holder;
		if (view == null) {
			holder = new Holder();
			view = LayoutInflater.from(context).inflate(
					R.layout.sto_statistics_count, null);
			holder.unSendCount = (TextView) view
					.findViewById(R.id.statistics_unsend);
			holder.sendCount = (TextView) view
					.findViewById(R.id.statistics_send);
			view.setTag(holder);
		} else {
			holder = (Holder) view.getTag();
		}
		holder.unSendCount.setText(courierList.get(position).getUnSendCount());
		holder.sendCount.setText(courierList.get(position).getSendCount());

		return view;
	}

	class Holder {
		TextView unSendCount;
		TextView sendCount;
	}

}
